package homework2;

public class Print {
	private final Object lock = new Object();
	private int currentNumber = 1;
	private char currentLetter = 'A';

	public void printN() {
		while (currentNumber <= 52) {
			synchronized (lock) {
				System.out.println(currentNumber);
				currentNumber++;
				System.out.println(currentNumber);
				currentNumber++;
				lock.notify();
				try {
					lock.wait();
				} catch (InterruptedException e) {

					e.printStackTrace();
				} 

			}
		}
	}

	public void printZ() {
		while (currentLetter <= 'Z') {
			synchronized (lock) {
				System.out.println(currentLetter);
				currentLetter++;
				lock.notify();
				try {
					lock.wait();
				} catch (InterruptedException e) {

					e.printStackTrace();
				} 
			}
		}
	}
}